class Solution {
public:
    bool isAnagram(string s, string t) {
        char ch[26] = {0};
        for(size_t i = 0; i < s.size(); ++i)
            ch[s[i]-'a'] += 1;
        for(size_t i = 0; i < t.size(); ++i)
            ch[t[i]-'a'] -= 1;

        for(size_t i = 0; i < 26; ++i){
            if(ch[i] != 0) return false;
        }
        return true;
    }
};